<template>
  <div class="blog-detail markdown-body hljs" ref="hlDiv" v-html="formatCode"></div>
</template>

<script>
import '~/assets/styles/theme.css';

export default {
  props: {
    code: {
      type: String,
      required: true,
      default() {
        return ''
      }
    }
  },

  computed: {
    formatCode() {
      return this.code.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&apos;/g, "'");
    }
  }
}
</script>

<style lang="scss" scoped>
.blog-detail.hljs {
  background: none !important;
}
</style>